<template>
  <PiTable
    isSearch
    default-expand-all
    :isPagination="false"
    row-key="id"
    :tableData
    :tableColumns
    :pagination="page"
  >
    <template #icon>
      <el-icon><Setting /></el-icon>
    </template>
    <!--<template #name="{ row }">-->
    <!--  <el-link-->
    <!--    type="primary"-->
    <!--    v-jump.open="['projectDetail', { oid: row.oid, title: `${row.name}，${row.projectName}` }]"-->
    <!--  >-->
    <!--    {{ row.name }}-->
    <!--  </el-link>-->
    <!--</template>-->
  </PiTable>
</template>

<script setup>
const route = useRoute();
const loading = ref(false);
const tableColumns = ref([]);
const tableData = ref([]);
const page = reactive({
  pageNum: 1, //当前页
  pageSize: 10000, //每页数
  total: 0, //数据总量
  fullData: true,
});

onMounted(() => {
  getData();
});

/**
 * 获取表格数据
 * */
const getData = () => {
  loading.value = true;
  const params = {
    tableID: 'ProjectTeamTable',
    oid: route.query.oid,
  };

  window.$api.projectListApi
    .findMembers(params)
    .then((res) => {
      tableColumns.value = res.data.columns.map((item) => ({
        ...item,
        sortable: true,
        search: true,
      }));
      tableData.value = res.data.rows;
      page.total = res.data.total;
    })
    .finally(() => {
      loading.value = false;
    });
};
</script>

<style scoped lang="less"></style>
